<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <!-- ===== 引入 ===== -->
  <link rel="stylesheet" href="./css/main.css">
  <title>侧边栏子菜单</title>
</head>
<style></style>
<body id="body-pd">
<div class="l-navbar" id="navbar">
  <nav class="nav">
    <div>
      <div class="nav__brand">
        <input type="hidden" id="empid"/>
        <ion-icon name="menu-outline" class="nav__toggle" id="nav-toggle"></ion-icon>
        <a href="#" class="nav__logo"><span id="name"></span></a>
      </div>
      <script src="js/jquery-1.12.4.js"></script>
      <script>
          var id = sessionStorage.getItem('eid')
          // alert(id)
          $.ajax(`/jboa/api/employee/Byid/${id}`,{
            type: "get",
            dataType: "json",
            contentType: "application/json;charset=utf-8",
            success: function (data) {
              $('#empid').val(data.employeeid);
              $('#name').text("职位："+data.positionname+" "+data.employeename)
              sessionStorage.setItem('employeeid',data.employeeid)
              sessionStorage.setItem('name',data.employeename)
              sessionStorage.setItem('positionname',data.positionname)
            }
          })
      </script>
      <div class="nav__list">
        <div  class="nav__link collapse">
          <ion-icon name="folder-outline" class="nav__icon"></ion-icon>
          <span class="nav__name">请假单管理</span>

          <ion-icon name="chevron-down-outline" class="collapse__link"></ion-icon>

          <ul class="collapse__menu">
            <a href="#home" id="qinjia" class="collapse__sublink">新增请假单</a><br/>
            <a href="#messages" id="chakan" class="collapse__sublink">查看请假单</a>
          </ul>
        </div>

        <div  class="nav__link collapse">
          <ion-icon name="folder-outline" class="nav__icon"></ion-icon>
          <span class="nav__name">报销单管理</span>

          <ion-icon name="chevron-down-outline" class="collapse__link"></ion-icon>

          <ul class="collapse__menu">
            <a href="#" onclick="xingzeng(sessionStorage.getItem('eid'))" class="collapse__sublink">新增报销单</a><br/>
            <a id="bxd" href="#ckbx" class="collapse__sublink">查看报销单</a>
          </ul>
        </div>

        <a href="#" id="tj" class="nav__link">
          <ion-icon name="pie-chart-outline" class="nav__icon"></ion-icon>
          <span class="nav__name">统计</span>
        </a>
    </div>

    <a id="tuichu" href="#" class="nav__link">
      <ion-icon name="log-out-outline" class="nav__icon"></ion-icon>
      <span class="nav__name">退出登陆</span>
    </a>
    </div>
  </nav>
</div>
<div id="main" style="background-color: #cccccc; width: 600px;height:400px;">

</div>
<button class="click" id="sxt">扇形图</button>
<button class="click" id="szt">树状图</button>
<button id="class">关闭</button>

<!--<script src="https://cdn.jsdelivr.net/npm/echarts@4.7.0/dist/echarts.min.js"></script>-->
<script src="webjars/echarts/4.7.0/dist/echarts.min.js"></script>
<script type="text/javascript">
  $('#tuichu').click(function (){
    location.href="login.html"
  })
  $('#tj').click(function () {
    $('#main').show()
    $('#sxt').show();
    $('#szt').show();
    $('#class').show()
  })
  $('#main').hide()
  $('#class').click(function () {
    $('#main').hide()
    $('#sxt').hide();
    $('#szt').hide();
    $('#class').hide()
  })
  $('#sxt').hide();
  $('#szt').hide();
  $('#class').hide()
  document.addEventListener('DOMContentLoaded', function() {
    var option = {}
    $('#szt').click(function () {
      var name = [];
      var num = [];
      $.ajax(`/jboa/count/querycount`, {
        type: "get",
        dataType: "json",
        contentType: 'application/json',
        success: function (data) {
          console.log(data);
          data.forEach(function (item) {
            name.push(item.departmentname);
            num.push(item.departmentTotal);
          });
          console.log(name);
          console.log(num);
          // 在数据加载完成后初始化图表
          var myChart = echarts.init(document.getElementById('main'));
          option = {
            title: {
              text: 'ECharts 入门示例'
            },
            tooltip: {},
            xAxis: {
              data: name
            },
            yAxis: {},
            series: [{
              name: '销量',
              type: 'bar',
              data: num
            }]
          };
          // 使用刚指定的配置项和数据显示图表。
          myChart.setOption(option);
          $('#szt').hide();
          $('#sxt').show();
        }
      });
    });
    $('#sxt').click(function (){
      var name = [];
      var num = []; // 使用数组来存储每个部门的数据
      $.ajax(`/jboa/count/querycount`, {
        type: "get",
        dataType: "json",
        contentType: 'application/json',
        success: function (data) {
          console.log(data);
          data.forEach(function (item) {
            name.push(item.departmentname);
            num.push({
              value: item.departmentTotal,
              name: item.departmentname
            });
          });
          console.log(name);
          console.log(num);
          // 确保在数据加载完成后初始化图表
          var myChart = echarts.init(document.getElementById('main'));
          option = {
            title: {
              text: '扇形图示例',
              subtext: '纯属虚构',
              left: 'center'
            },
            tooltip: {
              trigger: 'item',
              formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            legend: {
              orient: 'vertical',
              left: 'left',
              data: name
            },
            series: [
              {
                name: '访问来源',
                type: 'pie',
                radius: '55%',
                center: ['50%', '60%'],
                data: num,
                emphasis: {
                  itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                  }
                }
              }
            ]
          };
          myChart.setOption(option);
          $('#sxt').hide();
          $('#szt').show();
        }
      });
    });
  })
</script>


























<style>
  table {
    width: 100%;
    border-collapse: collapse;
  }
  th, td {
    border: 1px solid #000;
    padding: 8px;
    text-align: left;
  }
  .header {
    background-color: #f2f2f2;
  }
  .amount {
    text-align: right;
  }
  .status {
    color: blue;
  }
  .form-group {
    margin-bottom: 15px;
  }
  .form-group label{
    display: block;
    margin-bottom: 5px;
  }
  .form-group textarea {
    width: 100%;
    height: 100px;
    padding: 8px;
    box-sizing: border-box;
  }
  .form-group input[type="submit"],
  .form-group input[type="button"] {
    padding: 10px 20px;
    margin-right: 10px;
    cursor: pointer;
  }
  table{
    margin-bottom: 20px;
  }
</style>
<div class="bxdgx">
  <h2>报销单更新</h2>

  <table>
    <tr>
      <th colspan="4" class="header">基本信息</th>
    </tr>
    <tr>
      <td>编号：</td>
      <td><span id="id-bh"></span></td>
      <td>填写人：</td>
      <td><span id="id-txr"></span></td>
    </tr>
    <tr>
      <td>部门：</td>
      <td><span id="id-dep"></span></td>
      <td>职位：</td>
      <td><span id="id-pos"></span></td>
    </tr>
    <tr>
      <td>总金额：</td>
      <td class="amount"><span id="id-money"></span></td>
      <td>填报时间：</td>
      <td><span id="id-time"></span></td>
    </tr>
    <tr>
      <td>状态：</td>
      <td colspan="3" class="status"><span id="id-zt"></span></td>
    </tr>
    <tr>
      <td>待处理人：</td>
      <td colspan="3"><span id="id-clr"></span></td>
    </tr>
  </table>

  <form>
    <table>
      <tbody id="list">

      </tbody>
    </table>
    <input id="addBtn" type="button" value="加入"/>
    <div class="form-group">
      <label for="details">* 事由</label>
      <textarea id="details" name="details" required></textarea>
    </div>
    <div class="form-group">
      <input type="button" id="batchBtn" value="提交">
      <input id="qx" type="button" value="返回">
    </div>
  </form>
</div>
<div class="bxdxz">
  <h2>报销单新增</h2>

  <table>
    <tr>
      <th colspan="4" class="header">基本信息</th>
    </tr>
    <tr>
      <td>编号：</td>
      <td><span id="id1-bh"></span></td>
      <td>填写人：</td>
      <td><span id="id1-ren"></span></td>
    </tr>
    <tr>
      <td>部门：</td>
      <td><span id="id1-dep"></span></td>
      <td>职位：</td>
      <td><span id="id1-pos"></span></td>
    </tr>
    <tr>
      <td>总金额：<span id="zje"></span></td>
      <td class="amount"></td>
      <td>填报时间：</td>
      <td></td>
    </tr>
    <tbody id="list1">

    </tbody>
  </table>
  <form>

    <input id="addBtn1" type="button" value="加入"/>
    <div class="form-group">
      <label for="details">* 事由</label>
      <textarea id="event" name="details" required></textarea>
    </div>
    <div class="form-group">
      <input type="button" value="保存"/>
      <input type="button" id="batchBtn1" value="提交">
      <input id="qx1" type="button" value="返回">
    </div>
  </form>
</div>
<script src="js/jquery-1.12.4.js"></script>
<script>
  $('.bxdxz').hide()
  var ReimburseDetail1 = {}
  function xingzeng(eid) {

    $('.bxdxz').show()
    // sessionStorage.setItem('employeeId',employeeid)
    // sessionStorage.setItem('mainid',reimburseid)
    $.ajax(`/jboa/api/employee/Byid/${eid}`,{
      type:"get",
      dataType:"json",
      contentType:'application/json',
      success:function (data) {
        console.log(data)
        $('#id1-bh').text(data.employeeid);
        $('#id1-ren').text(data.employeename);
        // sessionStorage.setItem('mainid',data.reimburseid)
        $('#id1-dep').text(data.departmentname);
        $('#id1-pos').text(data.positionname);

        ReimburseDetail1["typeid"]=2
        ReimburseDetail1["createman"] = sessionStorage.getItem('eid')
        ReimburseDetail1["createtime"] = new Date().toLocaleDateString();
        ReimburseDetail1["departmentid"] = data.departmentid
        ReimburseDetail1["nextdealman"] = data.pid
        ReimburseDetail1["status"] = 1
      }
    })
  }
  $('#qx1').click(function () {
    $('.bxdxz').hide()
  })


  //splice
  persons = new Array();//数组提交

  //图片数组
  var base64Data = new Array();

  //选择预览图片
  $(document).on(
          "change",'input[name="attachment"]',
          function (e) {
            var fr = new FileReader();//读取文件
            var file = this.files[0];//选择第一个文件
            console.log(file);
            var _temp = file.name.match(/\.jpg|\.png|\.gif|\.bmp/i);
            if (!_temp) {
              this.value = "";
              alert("目前只支持jpg,png,bmp,gif格式图片文件");
              return false;
            } else if (file.size > (1024 * 1024)) {
              this.value = "";
              alert("目前只支持小于1M大小图片文件");
              return false;
            }
            var _this=$(this)
            fr.readAsDataURL(file);//读取文件
            //操作文件事件
            fr.onload =function ()  {
              base64Data[0] = this.result;//获得base编码字符串格式
              // console.log($(this).next('img')+base64Data[0])
              _this.next('img').attr("src", base64Data[0]);//显示图片
            };
          });
  //加入
  var zje = 0;
  var number = 0;
  var category;
  function lb(_this){
    category = _this.value;
  }
  var je1;
  function je(_this){
    je1 = _this.value;
  }
  var src;
  function tp(_this) {
    var imgElement = $(_this).next('img'); // 选择 _this 元素之后的 img 元素
    if (imgElement.length) { // 检查是否成功选择了 img 元素
      var src = imgElement.attr('src'); // 获取 img 元素的 src 属性值
      console.log(src); // 打印 src 属性值
    } else {
      console.log('No img element found after the input.');
    }
  }
  $("#addBtn1").click(
          function () {
            zje = 0;
            $('.amount').each(function () {
              zje += Number($(this).val())
            })
            $('#zje').text(zje)
            var line = `
            <tr class="form-group">
              <td>
                <label for="category">项目类别</label>
                <input type="text" id="category" onchange="lb(this)" name="category" required>
              </td>
              <td>
                <label for="amount">项目金额</label>
                <input type="text" id="amount" onchange="je(this)" class="amount" name="amount" required>
              </td>
              <td>
                <span>  * 附件</span>
                <input type="file" id="imgFile" onchange="tp(this)" name="attachment" accept="image/*">
                <img class="preShow" id="show" width="100" height="100"  src="" alt="预览图片">
              </td>
            </tr>
            `
            $("#list1").append(line);
            var ReimburseDetail = {}
            // alert(sessionStorage.getItem('employeeId'))
            $.ajax(`/jboa/api/employee/Byid/${sessionStorage.getItem('eid')}`,{
              type:"get",
              dataType:"json",
              contentType:'application/json',
              success:function (data) {
                // alert(data.pid)
                if (data.pid!=0 || sessionStorage.getItem('positionname') == "出纳") {
                  ReimburseDetail1['nextdealman'] = data.pid;
                  ReimburseDetail['nextdealman'] = data.pid;
                }else{
                  ReimburseDetail1['nextdealman'] = 1002
                  ReimburseDetail['nextdealman'] = 1002
                }
              }
            })
            // alert(zje)
            ReimburseDetail1['totalCount'] = zje
            setTimeout(function () {
              ReimburseDetail["statusid"]=3;
              // ReimburseDetail["id"] = $("#id").val();
              ReimburseDetail["desc"] = category;
              ReimburseDetail["subTotal"] = je1;
              ReimburseDetail["picturePath"] = src;
              console.log("--------------")
              console.log(ReimburseDetail)
              console.log("--------------")
              persons.splice(1, 0, ReimburseDetail);//追加
            },1000)
          });

  //批量提交
  $("#batchBtn1").click(function () {
    ReimburseDetail1["event"] = $("#event").val();
    persons.splice(0, 0, ReimburseDetail1);
    console.log(persons)
    // console.log(JSON.stringify(persons))
    $.ajax("/jboa/api/reimburse/insert2", {
      type: "post",
      dataType: "json",
      contentType: "application/json",//非常重要
      //序列化
      data: JSON.stringify(persons),//提交json数组
      success: function (data) {
        if (data.code == "200") {
          alert("新增成功");
          persons = new Array();
          $("#list").empty();
          $(".preShow").attr("src", "");
        }else {
          alert("新增失败");
        }
      }
    });
  });
</script>
<script>
  $('.bxdgx').hide()
  $('#qx').click(function () {
    $('.bxdgx').hide()
  })
</script>
<script>
  //splice
  persons = new Array();//数组提交

  //图片数组
  var base64Data = new Array();

  //选择预览图片
  $(document).on(
          "change",'input[name="attachment"]',
          function (e) {
            var fr = new FileReader();//读取文件
            var file = this.files[0];//选择第一个文件
            console.log(file);
            var _temp = file.name.match(/\.jpg|\.png|\.gif|\.bmp/i);
            if (!_temp) {
              this.value = "";
              alert("目前只支持jpg,png,bmp,gif格式图片文件");
              return false;
            } else if (file.size > (1024 * 1024)) {
              this.value = "";
              alert("目前只支持小于1M大小图片文件");
              return false;
            }
            var _this=$(this)
            fr.readAsDataURL(file);//读取文件
            //操作文件事件
            fr.onload =function ()  {
              base64Data[0] = this.result;//获得base编码字符串格式
              // console.log($(this).next('img')+base64Data[0])
              _this.next('img').attr("src", base64Data[0]);//显示图片
            };
          });
  function xiugai(reimburseid,employeeid) {
    $('.bxdgx').show()
    sessionStorage.setItem('employeeId',employeeid)
    sessionStorage.setItem('mainid',reimburseid)
    $.ajax(`/jboa/api/reimburse/queryByid/${reimburseid}`,{
      type:"get",
      dataType:"json",
      contentType:'application/json',
      success:function (data) {
        console.log(data)
        $('#id-bh').text(data.reimburseid);
        $('#id-ren').text(data.employeename);
        sessionStorage.setItem('tianxieren',data.reimburseid)
        $('#id-dep').text(data.departmentName);
        $('#id-pos').text(data.positionname);
        $('#id-money').text(data.totalcount);
        $('#id-time').text(data.createtime);
        $('#id-zt').text(data.status);
        $('#id-clr').text(data.name);
        $('#list').empty();
        $.each(data.reimburseDetailslist,function (index,element) {
          sessionStorage.setItem('Id',element.id)
          //解码
          // alert(element.picturepath)
          base64Data[0] = element.picturepath;
          var html = `
            <tr class="form-group">
                <input type="hidden" id="id${element.id}" value="${element.id}"/>
            </tr>
            <tr class="form-group">
              <td>
                <label for="category">项目类别</label>
                <input type="text" id="category${element.id}" name="category" value="${element.desc}" required/>
              </td>
              <td>
                <label for="amount">项目金额</label>
                <input type="text" id="amount${element.id}" name="amount" value="${element.subtotal}" required>
              </td>
              <td>
                <span>  * 附件</span>
                <input type="file" id="imgFile${element.id}" name="attachment" accept="image/*">
                <img class="preShow" width="100" height="100" src="${base64Data[0]}" alt="预览图片">
              </td>
              <td>
                <input type="button" value="删除" id="delBtn">
              </td>
            </tr>
          `
          $('#list').append(html)
          var ReimburseDetail = {};
          // alert(sessionStorage.getItem('employeeId'))
          $.ajax(`/jboa/api/employee/Byid/${sessionStorage.getItem('employeeId')}`,{
            type:"get",
            dataType:"json",
            contentType:'application/json',
            success:function (data) {
              // alert(data.pid)
              if (data.positionname != "出纳") {
                // alert(data.pid)
                reimburse["nextDealMan"] = data.pid;
              }else {
                alert(1)
                checkMan = null;
                reimburse["nextDealMan"] = 10000;
                reimburse["statusId"] = 5;
              }
              if (data.positionname == "总经理"){
                reimburse["nextDealMan"] = 1002;
              }
            }
          })
          ReimburseDetail["statusid"]=3;
          ReimburseDetail["mainid"]=element.mainid;
          ReimburseDetail["id"] = $("#id"+element.id).val();
          ReimburseDetail["desc"] = $("#category"+element.id).val();
          ReimburseDetail["subTotal"] = $("#amount"+element.id).val();
          ReimburseDetail["picturePath"] = $('#show'+element.id).attr("src");
          console.log(ReimburseDetail)
          persons.push(ReimburseDetail);
        })
        // $.each(data.checklist,function (index,element) {
        //   var html = `
        //   <tr>
        //     <td>${element.employeename}</td>
        //     <td>审核意见：${element.checkcomment}</td>
        //     <td>${element.checktime}</td>
        //     <td>审核：${element.resultname}</td>
        //   </tr>
        //   `
        //   $('#tt').append(html)
        // })
      }
    })
  }
  //加入
  $("#addBtn").click(
          function () {
            var id = sessionStorage.getItem('id')+1
            var line = `
            <tr class="form-group">
              <td>
                <label for="category">项目类别</label>
                <input type="text" id="category${id}" name="category" required>
              </td>
              <td>
                <label for="amount">项目金额</label>
                <input type="text" id="amount${id}" name="amount" required>
              </td>
              <td>
                <span>  * 附件</span>
                <input type="file" id="imgFile${id}" name="attachment" accept="image/*">
                <img class="preShow" id="show${id}" width="100" height="100" src="" alt="预览图片">
              </td>
              <td>
                <input type="button" value="删除" id="delBtn">
              </td>
            </tr>
            `
            $("#list").append(line);
            var ReimburseDetail = {};
            // alert(sessionStorage.getItem('employeeId'))
            $.ajax(`/jboa/api/employee/Byid/${sessionStorage.getItem('eid')}`,{
              type:"get",
              dataType:"json",
              contentType:'application/json',
              success:function (data) {
                // alert(data.pid)
                ReimburseDetail['nextdealman'] = data.pid;
              }
            })
            setTimeout(function () {
              ReimburseDetail["statusid"]=3;
              ReimburseDetail["mainid"] = sessionStorage.getItem('mainid');
              ReimburseDetail["id"] = $("#id"+id).val();
              ReimburseDetail["desc"] = $("#category"+id).val();
              ReimburseDetail["subTotal"] = $("#amount"+id).val();
              ReimburseDetail["picturePath"] = $('#show'+id).attr("src");
              console.log(ReimburseDetail)
              persons.push(ReimburseDetail);//追加
            },1000)
          });

  //删除
  $("#list").on("click", "#delBtn", function () {
    var index = $(this).closest("tr").index();
    persons.splice(index, 1);
    $(this).closest("tr").remove();
  })
  //批量提交
  $("#batchBtn").click(function () {

    // console.log(JSON.stringify(persons))
    $.ajax("/jboa/api/reimburse/upd2", {
      type: "post",
      dataType: "json",
      contentType: "application/json",//非常重要
      //序列化
      data: JSON.stringify(persons),//提交json数组
      success: function (data) {
        if (data.code == "200") {
          alert("修改成功");
          persons = new Array();
          $("#list").empty();
          $(".preShow").attr("src", "");
        }else {
          alert("修改失败");
        }
      }
    });
  });
</script>
<style>
  body {
    font-family: Arial, sans-serif;
  }
  .con {
    width: 80%;
    margin: 0 auto;
    border: 1px solid #ccc;
    padding: 20px;
    border-radius: 5px;
    background-color: #f9f9f9;
  }
  .header {
    background-color: #e0e0e0;
    padding: 10px;
    border-bottom: 1px solid #ccc;
    font-weight: bold;
  }
  .filter {
    margin-bottom: 20px;
  }
  .filter label {
    margin-right: 10px;
  }
  .filter input {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
  }
  .filter button {
    padding: 5px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
  }
  table {
    width: 100%;
    border-collapse: collapse;
  }
  table, th, td {
    border: 1px solid #ccc;
  }
  th, td {
    padding: 10px;
    text-align: center;
  }
  th {
    background-color: #f2f2f2;
  }
  .pagination {
    margin-top: 20px;
    text-align: center;
  }
  .pagination a {
    margin: 0 5px;
    text-decoration: none;
    color: #4CAF50;
  }
  .con{
    display: none;
  }
</style>
<div id="ckbx" class="con">
  <div class="header">报销单列表</div>
  <div class="filter">
    <label for="status">报销单状态</label>
    <select id="statuss">
      <option value="">全部</option>
      <!-- 可以添加更多选项 -->
    </select>
    <label for="start-time">开始时间</label>
    <input type="date" id="start-times">
    <label for="end-time">结束时间</label>
    <input type="date" id="end-times">
    <button id="cxx">查询</button>
  </div>
  <table>
    <thead>
    <tr>
      <th>编号</th>
      <th>填报日期</th>
      <th>填报人</th>
      <th>总金额</th>
      <th>状态</th>
      <th>待处理人</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody id="tb">

    </tbody>
  </table>
  <div class="pagination">
    <a href="#" onclick="sy1()">首页</a>
    <a href="#" onclick="syy1()">上一页</a>
    <a href="#" onclick="xyy1()">下一页</a>
    <a href="#" onclick="wy1()">末页</a>
  </div>
</div>
<style>
  body {
    font-family: Arial, sans-serif;
  }
  .e {
    width: 600px;
    margin: 0 auto;
    border: 1px solid #ccc;
    padding: 20px;
    border-radius: 5px;
    background-color: #f9f9f9;
  }
  .header {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
  }
  .info {
    margin-bottom: 20px;
  }
  .info div {
    margin-bottom: 10px;
  }
  .info span {
    font-weight: bold;
  }
  .approval {
    border-top: 1px dashed #000;
    padding-top: 10px;
  }
  .approval textarea {
    width: 100%;
    height: 100px;
    margin-top: 10px;
  }
  .footer {
    text-align: center;
    margin-top: 20px;
  }
  .footer button {
    padding: 5px 20px;
    font-size: 16px;
  }
</style>
<div class="e">
  <div class="header">查看请假</div>
  <div class="info">
    <div><span>姓名：</span><span id="span-name"></span></div>
    <div><span>部门：</span><span id="span-bumen"></span></div>
    <div><span>开始时间：</span><span id="span-stime"></span></div>
    <div><span>结束时间：</span><span id="span-etime"></span></div>
    <div><span>请假天数：</span><span id="span-num"></span></div>
    <div><span>请假类型：</span><span id="span-liexin"></span></div>
    <div><span>请假事由：</span><span id="span-shiyou"></span></div>
    <div><span>审批状态：</span><span id="span-zt"></span></div>
  </div>
  <table>
    <tbody id="tbody1">
    <!-- 其他记录... -->
    </tbody>
  </table>
  <div class="approval">
    <div>审批意见：</div>
    <textarea></textarea>
  </div>
  <div class="footer">
    <button id="hqq">返回</button>
  </div>
</div>
<style>
  body {
    font-family: Arial, sans-serif;
  }
  .container {
    width: 80%;
    margin: 0 auto;
    border: 1px solid #ccc;
    padding: 20px;
    box-shadow: 2px 2px 12px #aaa;
  }
  .header {
    background-color: #f0f0f0;
    padding: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
  }
  .info {
    margin-top: 20px;
  }
  .info div {
    margin-bottom: 10px;
  }
  .info span {
    display: inline-block;
    width: 150px;
    font-weight: bold;
  }
  .table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
  }
  .table th, .table td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
  }
  .table th {
    background-color: #f9f9f9;
  }
  .footer {
    margin-top: 20px;
    text-align: center;
  }
  .footer button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
  }
</style>
<div class="c">
  <div class="header">查看报销单</div>
  <div class="info">
    <div>编号：<span id="bh"></span> 填写人：<span id="ren"></span></div>
    <div>部门：<span id="dep"></span> 职位：<span id="pos"></span></div>
    <div>总金额：<span id="money"></span> 填报时间：<span id="times"></span></div>
    <div>状态：<span id="zt"></span> 待处理人：<span id="clr"></span></div>
  </div>
  <table class="table">
    <thead>
    <tr>
      <th>姓名</th>
      <th>意见</th>
      <th>时间</th>
      <th>审核</th>
    </tr>
    </thead>
    <tbody id="tt">
    <!-- 这里可以添加行 -->
    </tbody>
  </table>
  <table>
    <thead>
    <tr>
      <th>项目类别</th>
      <th>项目金额</th>
    </tr>
    </thead>
    <tbody id="qq"></tbody>
  </table>
  <div class="footer">
    <button id="hq">返回</button>
  </div>
</div>
<script src="js/jquery-1.12.4.js"></script>
<script>
  $.ajax("/jboa/api/reimburse/queryAllStatus",{
    type: "get",
    dataType: "json",
    contentType: "application/json",
    success: function (data) {
      $.each(data,function (i,n) {
        var html = `
        <option value="${n.statusid}">${n.statusname}</option>
      `
        $('#statuss').append(html)
      })
    }
  })
</script>
<script>
  var starttimes
  var endtimes
  var statusid
  var pagebean;
  function fy(p,s,starttimes,endtimes,statusid) {
    // alert(statusid)
    $('#tb').empty()
    $.ajax(`/jboa/api/reimburse/queryreimburse/${p}/${s}/${starttimes}/${endtimes}/${statusid}`,{
      type: 'get',
      dataType: 'json',
      contentType: 'application/json',
      success: function (data) {
        // console.log(data)
        pagebean = data
        $('#tb').empty()
        $.each(data.list,function (i,n) {
          var html = `
                <tr>
                  <td>${n.employeeid}</td>
                  <td>${n.createtime}</td>
                  <td>${n.employeename}</td>
                  <td>${n.totalcount}</td>
                  <td>${n.status}</td>
                  <td>${n.name}</td>
                  <td>
                    <button id="id-${n.reimburseid}" onclick="xiugai(${n.reimburseid},${n.employeeid})">修改</button>
                    <button onclick="chakan(${n.reimburseid},${n.employeeid})">查看</button>
                    <button id="${n.reimburseid}" onclick="cll(${n.reimburseid},${n.employeeid})">✅</button>
                  </td>
                </tr>
              `
          $('#tb').append(html)
          var name = n.name
          if ((n.status=="审批中"|| n.status=="新创建")&&name == sessionStorage.getItem("name") ) {
            $('#'+n.reimburseid).show()
          }else {
            $('#'+n.reimburseid).hide()
          }
          if (n.status=="已打回"&&name == sessionStorage.getItem("name")) {
            $('#id-'+n.reimburseid).show()
          }else {
            $('#id-'+n.reimburseid).hide()
          }
        })
      }
    })
  }
  $('#hq').click(function () {
    $('.c').hide()
  })
  $('.c').hide()
  function chakan(reimburseid,employeeid) {
    $('.c').show()
    $('#reimburseid').val(reimburseid)
    $('#employeeid').val(employeeid)
    f1(reimburseid)
  }
  function f1(reimburseid) {
    // alert(reimburseid)
    $('#tt').empty()
    $('#qq').empty()
    $.ajax(`/jboa/api/reimburse/queryByid/${reimburseid}`,{
      type:"get",
      dataType:"json",
      contentType:'application/json',
      success:function (data) {
        console.log(data)
        $('#bh').text(data.reimburseid);
        $('#ren').text(data.employeename);
        sessionStorage.setItem('tianxieren',data.reimburseid)
        $('#dep').text(data.departmentName);
        $('#pos').text(data.positionname);
        $('#money').text(data.totalcount);
        $('#times').text(data.createtime);
        $('#zt').text(data.status);
        $('#clr').text(data.name);
        $('#feiyong').empty();
        $.each(data.reimburseDetailslist,function (index,element) {
          var html = `
          <tr>
            <td>${element.desc}</td>
            <td class="amount">¥${element.subtotal}</td>
            <td colspan="2"></td>
          </tr>
          `
          $('#qq').append(html)
        })
        $.each(data.checklist,function (index,element) {
          var html = `
          <tr>
            <td>${element.employeename}</td>
            <td>审核意见：${element.checkcomment}</td>
            <td>${element.checktime}</td>
            <td>审核：${element.resultname}</td>
          </tr>
          `
          $('#tt').append(html)
        })
      }
    })
  }
  function cll(id,employeeid) {
      sessionStorage.setItem('employeeid', employeeid)
      $('#co').show()
      $('#reimburseid').val(id)
      yunx()
  }
    $('#cxx').click(function () {
      starttimes = $('#start-times').val()==""?undefined:$('#start-times').val()
      endtimes = $('#end-times').val()==""?undefined:$('#end-times').val()
      statusid = $('#statuss').val()==""?undefined:$('#statuss').val()
      fy(1,10,starttimes,endtimes,statusid)
    })
  function sy1() {
    fy(1,10)
  }
  function syy1() {
    if (pagebean.hasPreviousPage) {
      fy(pagebean.prePage, 10,starttimes,endtimes,statusid);
    }
  }
  function xyy1() {
    // alert(!pagebean.isLastPage)
    if (!pagebean.isLastPage) {
      // console.log(pagebean.nextPage)
      fy(pagebean.nextPage, 10,starttimes,endtimes,statusid);
    }
  }
  function wy1() {
    fy(pagebean.lastPage,10,starttimes,endtimes,statusid);
  }
    $('#bxd').click(function () {
      fy(1,10)
    })
</script>

<div id="home" class="content">
  <h2>请假</h2>
  <p>
    <input type="hidden" id="next"/>
    <input type="hidden" id="employeeid" value=""/>
    <input type="hidden" id="departmentid" value=""/>
    <table border="0">
      <tr>
        <td>姓名:</td>
        <td><input type="text" readonly id="pname"/></td>
      </tr>
      <tr>
        <td>部门:</td>
        <td><input type="text" id="bumen" readonly value="0"/></td>
      </tr>
      <tr>
        <td>开始时间:</td>
        <td><input type="date" id="ddate"/></td>
      </tr>
      <tr>
        <td>结束时间:</td>
        <td><input type="date" id="pdate"/></td>
      </tr>
      <tr>
        <td>请假天数:</td>
        <td><input type="text" readonly id="time"/></td>
      </tr>
      <tr>
        <td>请假事由:</td>
        <td><textarea id="shiyou"></textarea></td>
      </tr>
      <tr>
        <th colspan="2"><input id="regBtn" type="button" value="保存"/></th>
      </tr>
    </table>

  </p>
</div>
<style>
  table {
    width: 100%;
    border-collapse: collapse;
  }
  th, td {
    border: 1px solid #ddd;
    padding: 8px;
  }
  th {
    background-color: #f2f2f2;
  }
  tr:nth-child(even) {
    background-color: #f9f9f9;
  }
  tr:hover {
    background-color: #f1f1f1;
  }
  .status-pending {
    color: red;
  }
  .status-approved {
    color: green;
  }
  .status-rejected {
    color: orange;
  }
</style>
<div id="messages" class="content">
  <h2>请假审批系统</h2>

  <form id="form">
    <label for="start-time">开始时间:</label>
    <input type="date" id="start-time" name="start-time">
    <label for="end-time">结束时间:</label>
    <input type="date" id="end-time" name="end-time">
    <button id="cx" type="button">查询</button>
  </form>

  <table>
    <thead>
    <tr>
      <th>编号</th>
      <th>名称</th>
      <th>发起时间</th>
      <th>审批时间</th>
      <th>审批意见</th>
      <th>待处理人</th>
      <th>审批状态</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody id="tbody">
    <!-- 其他记录... -->
    </tbody>
  </table>

  <div>
    <a href="#" onclick="sy()">首页</a>
    <a href="#" onclick="syy()">上一页</a>
    <a href="#" onclick="xyy()">下一页</a>
    <a href="#" onclick="wy()">末页</a>
  </div>
</div>
<style>
  body {
    font-family: Arial, sans-serif;
  }
  .container {
    width: 600px;
    margin: 0 auto;
    border: 1px solid #ccc;
    padding: 20px;
    box-shadow: 2px 2px 12px #aaa;
  }
  .header {
    background-color: #4a90e2;
    color: white;
    padding: 10px;
    text-align: center;
  }
  .info {
    margin-top: 20px;
  }
  .info div {
    margin-bottom: 10px;
  }
  .info span {
    display: inline-block;
    width: 120px;
  }
  .status {
    font-weight: bold;
    color: #4a90e2;
  }
  .approval {
    margin-top: 20px;
  }
  .approval textarea {
    width: 100%;
    height: 60px;
  }
  .buttons {
    margin-top: 20px;
    text-align: center;
  }
  .buttons button {
    margin: 0 5px;
    padding: 5px 20px;
  }
  .container{
    display: none;
  }
</style>
<div class="container">
  <div class="header">审批请假</div>
  <div class="info">
    <div><span>姓名：</span><span id="empname"></span></div>
    <div><span>部门：</span><span id="posname"></span></div>
    <div><span>开始时间：</span><span id="stime"></span></div>
    <div><span>结束时间：</span><span id="etime"></span></div>
    <div><span>请假天数：</span><span id="tolot"></span></div>
    <div><span>请假事由：</span><span id="liy"></span></div>
    <div><span class="status">审批状态：</span><span id="status"></span></div>
  </div>
  <div class="approval">
    <label for="approval-opinion">审批意见：</label>
    <textarea id="approval-opinion"></textarea>
  </div>
  <div class="buttons">
    <button id="tg">审批通过</button>
    <button id="jj">审批拒绝</button>
    <button id="fh">返回</button>
  </div>
</div>
<script src="js/jquery-1.12.4.js"></script>
<script>
  var check = {}
  var i;
  var ui;
  var id = sessionStorage.getItem('eid');
  $('#fh').click(function () {
    $('.container').hide();
  })
  $('#tg').click(function () {
    ui = true;
    // alert(sessionStorage.getItem('id'))
    check["bizid"]=sessionStorage.getItem('leaveid');
    check["checkcomment"] = $('#approval-opinion').val();
    check["checkresult"] = 1;
    check["checktime"] = new Date().toLocaleDateString().replace(/\//g,"-");
    check["typeid"] = 1;
    // alert(sessionStorage.getItem("checkid"))
    check["checkman"]=id;
    check["statusid"] = 2;
    shenpi(check);
  })
  $('#jj').click(function () {
    i = false;
    check["bizid"]=sessionStorage.getItem('leaveid');
    check["checkcomment"] = $('#approval-opinion').val();
    check["checkresult"] = 2;
    check["checktime"] = new Date().toLocaleDateString().replace(/\//g,"-");
    check["typeid"] = 1;
    check["nextdealman"] = 10000;
    check["statusid"] = 4;
    check["checkman"]=id;
    shenpi(check);
  })

  var boon = true;
  function shenpi(check) {
    var id = sessionStorage.getItem('eid');
    // alert(id)
    $.ajax(`/jboa/api/check/querynextdealman/${id}`,{
      type:"get",
      dataType:"json",
      contentType:'application/json',
      success:function (data) {
        if (i&&data.code==200){
          // alert(data.nextdealman)
          if (data.nextdealman!=0) {
            check["nextdealman"] = data.nextdealman;
          }else {
           check["nextdealman"] = 1017;
          }
          if (data.nextdealman==1017) {
              check["nextdealman"] = 10000;
              check["statusid"] = 4;
            }
          }
        var id1 = sessionStorage.getItem('leaveid');
        // alert(id1)
        $.ajax(`/jboa/api/check/querycheckid/${id1}`,{
          type:"get",
          dataType:"json",
          contentType:'application/json',
          success:function (data) {
            if (i&&data.code==200){
              if (data.checkid!=0) {
                // alert(data.checkid)
                check["checkid"]=data.checkid;
              }
            }
          }
        })
        // console.log(check)
        setTimeout(function (){
          // alert(sessionStorage.getItem('positionname'))
          if (sessionStorage.getItem('positionname')=="人事") {
            check["nextdealman"] = 10000;
            check["statusid"] = 4;
          }else if (sessionStorage.getItem('positionname')=="总经理"&&i) {
            check["nextdealman"] = 1017;
          }
          $.ajax(`/jboa/api/check/add`, {
            type: "post",
            dataType: "json",
            contentType: 'application/json',
            data: JSON.stringify(check),
            success: function (data) {
              if (data.code == 200) {
                alert(data.msg)
              } else {
                alert(data.msg)
              }
            }
          })
        },1000)
        }
      })
    }


  var pagebean;
  var id = sessionStorage.getItem("departmentid");
  $('#chakan').click(function () {
    f(1,5)
  })
  function f(p,s,st,et) {
    $.ajax(`/jboa/api/leave/querybyid/${id}/${p}/${s}/${st}/${et}`, {
      type: 'get',
      dataType: "json",
      contentType: 'application/json',
      success: function (data) {
        pagebean=data;
        console.log(data)
        $('#tbody').empty();
        $.each(data.list,function (i,n) {
          var html = `
          <tr>
            <td>${n.leaveid}</td>
            <td>${n.event}</td>
            <td>${n.createtime}</td>
            <td>${n.checktime}</td>
            <td>${n.checkcomment}</td>
            <td>${n.employeename}</td>
            <td class="status-pending">${n.statusname}</td>
            <td><a href="#" onclick="chakan1(${n.leaveid})">查看</a> <a id="${n.leaveid}" onclick="dianji(${n.leaveid})">处理</a></td>
          </tr>
          `
          $('#tbody').append(html)
          var id = '#'+n.leaveid;
          if (n.employeename==sessionStorage.getItem('name')&&n.statusid==2){
            //展示a标签
            $(id).show();
            if (sessionStorage.getItem('positionname')=="人事"){
              $('#jj').hide();
            }else {
              $('#jj').show();
            }
            sessionStorage.setItem('departmentid',n.departmentid)
            sessionStorage.setItem('leaveid',n.leaveid)
            sessionStorage.setItem('createman',n.createman)
          }else {
            $(id).hide();
          }
        })
      }
    })
  }

  function dianji(id) {
    $('.container').show();
    $.ajax(`/jboa/api/leave/queryid/${id}`,{
      type:'get',
      dataType:'json',
      contentType:'application/json',
      success:function (data) {
        console.log(data)
        $('#empname').text(data.employeeName);
        $('#posname').text(data.departmentName);
        $('#stime').text(data.starttime);
        $('#etime').text(data.endtime);
        $('#tolot').text(data.totalcount);
        $('#liy').text(data.event);
        $('#status').text(data.statusName);
      }
    })
  }
  var st;
  var et;
  $('#cx').click(function () {
    st= $('#start-time').val()==""?undefined:$('#start-time').val();
    et = $('#end-time').val()==""?undefined:$('#end-time').val();
    f(1,5,st,et);
  })
  function sy() {
    f(1,5,st,et);
  }
  function syy() {
    if (pagebean.prePage > 0) {
      f(pagebean.prePage, 5,st,et);
    }
  }
  function xyy() {
    if (!pagebean.isLastPage) {
      f(pagebean.nextPage, 5,st,et);
    }
  }
  function wy() {
    f(pagebean.lastPage,5,st,et);
  }
</script>

<script type="text/javascript">
  $('.e').hide();
  $('#hqq').click(function () {
    $('.e').hide();
  })
  function chakan1(eid) {
    $('.e').show();
    $.ajax(`/jboa/api/leave/select/${eid}`,{
      type:"get",
      dataType:"json",
      contentType:'application/json',
      success:function (data) {
        console.log(data)
        // $('#span-').text(data.reimburseid);
        $('#span-name').text(data.employeename);
        // sessionStorage.setItem('tianxieren',data.reimburseid)
        $('#span-bumen').text(data.departmentName);
        // $('#span-').text(data.positionname);
        $('#span-stime').text(data.starttime);
        $('#span-etime').text(data.endtime);
        $('#span-num').text(data.totalcount);
        // $('#span-liexin').text(data.name);
        $('#span-shiyou').text(data.event);
        $('#span-zt').text(data.statusname);
        $('#tbody1').empty()
        $.each(data.checkList,function (i,n) {
          var html = `
          <tr>
            <td>${n.checkman}</td>
            <td>${n.employeename}</td>
            <td>${n.checktime}</td>
            <td>${n.checkcomment==""?"无":n.checkcomment}</td>
          </tr>
          `
          $('#tbody1').append(html)
        })
      }
    })
  }

  $('.collapse__sublink').click(function () {
    //获取当前元素的href内容
    var href = $(this).attr('href');
    //隐藏所有的div标签
    $('.content').hide();
    //显示id为href内容的div标签
    $(href).show();
  })
  var id = sessionStorage.getItem("eid");
  $('#regBtn').click(function () {
    //表单验证
    if ($('#shiyou').val() == "") {
      alert("请输入请假事由");
      return;
    }
    if ($('#ddate').val() == "") {
      alert("请输入开始时间");
      return;
    }
    if ($('#pdate').val() == "") {
      alert("请输入结束时间");
      return;
    }
    var bumen = $('#departmentid').val();
    var time = $('#time').val();
    var shiyou = $('#shiyou').val();
    var pid = $('#next').val();
    var ddate = $('#ddate').val();
    var pdate = $('#pdate').val();
    var employee = {};
    employee["createman"] = id;
    employee["totalcount"] = time;
    employee["shiyou"] = shiyou;
    employee["departmentid"] = bumen;
    employee["event"] = shiyou;
    employee["nextDealMan"] = pid;
    employee["statusId"] = 2;
    employee["createTime"] = new Date().toLocaleDateString();
    employee["starttime"] = ddate;
    employee["endtime"] = pdate;
    $.ajax({
      url: `/jboa/api/leave/insert`,
      dataType: "json",
      type: "post",
      data: JSON.stringify(employee),
      contentType: "application/json;charset=utf-8",
      success: function (data) {
        if (data.code == 200) {
          // alert(data.checkid)
          // checkid =data.checkid
          alert("提交成功");
        }else {
          alert("提交失败");
        }
      }
    })
  })
  $('#qinjia').click(function () {
    cli();
  })
  function cli(){
    $.ajax(`/jboa/api/employee/queryByid/${sessionStorage.getItem('eid')}`,{
      dataType: "json",
      type: "get",
      contentType: "application/json;charset=utf-8",
      success: function (data) {
        $('#next').val(data.pid);
        $('#departmentid').val(data.departmentid);
        $('#pname').val(data.employeename);
        $('#bumen').val(data.positionname);
      }
    })
  }
  function time(ddate,pdate){
    if(pdate < ddate){
      alert("结束时间不能小于开始时间");
      $('#pdate').val("")
      return;
    }else if (ddate == pdate){
      alert("开始时间不能等于结束时间");
      $('#pdate').val("")
      return;
    }
    var time = (new Date(pdate).getTime() - new Date(ddate).getTime()) / (1000 * 60 * 60 * 24);
    $('#time').val(time);
  }
  var ddate
  $('#ddate').change(function () {
    ddate = $('#ddate').val();
    ddate = ddate.replace(/-/g, '/');
    if (ddate <= new Date().toLocaleDateString()) {
      alert("开始时间不能小于当前时间");
      $('#ddate').val("")
    }
  })
  var pdate;
  $('#pdate').change(function () {
    pdate = $('#pdate').val();
    pdate = pdate.replace(/-/g, '/');
    time(ddate,pdate);
  })
</script>


<style>
  table {
    width: 100%;
    border-collapse: collapse;
  }
  th, td {
    border: 1px solid #000;
    padding: 8px;
    text-align: left;
  }
  /*.header {*/
  /*  background-color: #f2f2f2;*/
  /*}*/
  .amount {
    text-align: right;
  }
  .status {
    color: green;
  }
  .co{
    display: none;
  }
</style>
<input type="hidden" id="reimburseid"/>
<table id="co" class="co">
  <tr>
    <th colspan="4" class="header">审核报销单</th>
  </tr>
  <tr>
    <td>编号：</td>
    <td><span id="bianhao"></span></td>
    <td>填写人：</td>
    <td><span id="tianxieren"></span></td>
  </tr>
  <tr>
    <td>部门：</td>
    <td><span id="bumen1"></span></td>
    <td>职位：</td>
    <td><span id="zhiwei"></span></td>
  </tr>
  <tr>
    <td>总金额：</td>
    <td class="amount">¥<span id="zongjine"></span></td>
    <td>填报时间：</td>
    <td><span id="shijian"></span></td>
  </tr>
  <tr>
    <td>状态：</td>
    <td colspan="3" class="status"><span id="zhuangtai"></span></td>
  </tr>
  <tr>
    <td>待处理人：</td>
    <td colspan="3"><span id="chuliren"></span></td>
  </tr>
  <tr>
    <th>项目类别</th>
    <th>项目金额</th>
    <th colspan="2"></th>
  </tr>
  <tbody id="feiyong">

  </tbody>
  <tbody id="shenhe">

  </tbody>
  <tr>
    <td colspan="4">
      <textarea id="yijian" placeholder="意见"></textarea>
    </td>
  </tr>
  <tr>
    <td colspan="4">
      <button id="yes">同意</button>
      <button id="no">拒绝</button>
      <button id="back">打回</button>
      <input type="button" value="关闭" onclick="gb()"/>
    </td>
  </tr>
</table>
<script src="js/jquery-1.12.4.js"></script>
<script>
function gb() {
  $('#co').hide()
}
  var positionname = sessionStorage.getItem('positionname')
  if (positionname == '出纳') {
    $('#yes').show()
    $('#no').hide()
    $('#back').hide()
  }else {
    $('#yes').show()
    $('#no').show()
    $('#back').show()
  }
  var reimburseid
  function yunx() {
    reimburseid = $('#reimburseid').val()
    // alert(reimburseid)
    $.ajax(`/jboa/api/reimburse/queryByid/${reimburseid}`,{
      type:"get",
      dataType:"json",
      contentType:'application/json',
      success:function (data) {
        console.log(data)
        $('#bianhao').text(data.reimburseid);
        $('#tianxieren').text(data.employeename);
        sessionStorage.setItem('tianxieren',data.reimburseid)
        $('#bumen1').text(data.departmentName);
        $('#zhiwei').text(data.positionname);
        $('#zongjine').text(data.totalcount);
        $('#shijian').text(data.createtime);
        $('#zhuangtai').text(data.status);
        $('#chuliren').text(data.name);
        $('#feiyong').empty();
        $.each(data.reimburseDetailslist,function (index,element) {
          var html = `
          <tr>
            <td>${element.desc}</td>
            <td class="amount">¥${element.subtotal}</td>
            <td colspan="2"></td>
          </tr>
          `
          $('#feiyong').append(html)
        })
        console.log(data.checklist)
        $('#shenhe').empty()
        $.each(data.checklist,function (index,element) {
          var html = `
          <tr>
            <td>${element.employeename}</td>
            <td>审核意见：${element.checkcomment}</td>
            <td>${element.checktime}</td>
            <td>审核：${element.resultname}</td>
          </tr>
          `
          $('#shenhe').append(html)
        })
      }
    })
  }
</script>
<script>

</script>
<script>
  var reimburse = {}
  var positionname = sessionStorage.getItem('positionname');
  var checkMan = sessionStorage.getItem('employeeid');
  $('#no').click(function () {
    reimburse["bizId"] = reimburseid;
    reimburse["nextDealMan"]=10000
    reimburse["statusId"] = 4;
    reimburse["checkResult"] = 2;
    reimburse["checkTime"] = new Date().toLocaleDateString().replace(/\//g,'-');
    reimburse["createTime"] = new Date().toLocaleDateString().replace(/\//g,'-');
    reimburse["checkMan"] = sessionStorage.getItem('employeeid');;
    reimburse["typeId"] = 2;
    // alert(sessionStorage.getItem('employeeid'))
    reimburse["checkcomment"] = $('#yijian').val();
    setTimeout(function () {
      $.ajax(`/jboa/api/check/insert`, {
        type: "post",
        dataType: "json",
        contentType: 'application/json',
        data: JSON.stringify(reimburse),
        success: function (data) {
          if (data.code == 200) {
            alert('拒绝成功')
          } else {
            alert('拒绝失败')
          }
        }
      })
    },1000)
  })
  $('#yes').click(function () {
    var checkMan = sessionStorage.getItem('eid');
    if (checkMan != 0) {
      $.ajax(`/jboa/api/employee/Byid/${checkMan}`, {
        type: "get",
        dataType: "json",
        contentType: 'application/json',
        success: function (data) {
          checkMan = data.pid;
          // alert(data.positionname)
          if (data.positionname != "出纳") {
            // alert(data.pid)
            reimburse["nextDealMan"] = data.pid;
          }else {
            // alert(1)
            checkMan = null;
            reimburse["nextDealMan"] = 10000;
            reimburse["statusId"] = 5;
          }
          if (data.positionname == "总经理"){
            reimburse["nextDealMan"] = 1002;
          }
        }
      })
    }
    reimburse["bizId"] = reimburseid;
    if (positionname != "出纳") {
      reimburse["statusId"] = 3;
    }
    reimburse["checkResult"] = 1;
    reimburse["checkTime"] = new Date().toLocaleDateString().replace(/\//g,'-');
    reimburse["createTime"] = new Date().toLocaleDateString().replace(/\//g,'-');
    reimburse["checkMan"] = checkMan;
    reimburse["typeId"] = 2;
    // alert(sessionStorage.getItem('employeeid'))
    reimburse["checkcomment"] = $('#yijian').val();
    setTimeout(function () {
      $.ajax(`/jboa/api/check/insert`, {
        type: "post",
        dataType: "json",
        contentType: 'application/json',
        data: JSON.stringify(reimburse),
        success: function (data) {
          if (data.code == 200) {
            alert('同意成功')
          } else {
            alert('同意失败')
          }
        }
      })
    },1000)
  })
  $('#back').click(function () {
    reimburse["bizId"] = reimburseid;
    reimburse["statusId"] = 6;
    reimburse["checkResult"] = 3;
    reimburse["checkTime"] = new Date().toLocaleDateString().replace(/\//g,'-');
    reimburse["createTime"] = new Date().toLocaleDateString().replace(/\//g,'-');
    reimburse["checkMan"] = sessionStorage.getItem('eid');
    reimburse["typeId"] = 2;
    // alert(sessionStorage.getItem('employeeid'))
    reimburse["nextDealMan"]=sessionStorage.getItem('employeeid')
    reimburse["checkcomment"] = $('#yijian').val();
    $.ajax(`/jboa/api/check/insert`,{
      type:"post",
      dataType:"json",
      contentType:'application/json',
      data:JSON.stringify(reimburse),
      success:function (data) {
        if (data.code==200) {
          alert('打回成功')
        }else {
          alert('打回失败')
        }
      }
    })
  })
</script>


<!-- ===== 引入icon ===== -->
<script src="https://unpkg.com/ionicons@5.1.2/dist/ionicons.js"></script>

<!-- ===== 引入js ===== -->
<script src="js/main.js"></script>
</body>
</html>